The YOLOv3 model, which uses pre-trained weights for standard object detection problems, is accessible from the menu item Artificial Intelligence > Custom Deep Model Architecture > YOLOv3. This feature simplifies the training process, supports gray scale and color datasets, and lets you apply trained models on selected datasets. The results of applying a YOLOv3 object detection model are a series of 2D boxes around the objects of interest.
The following items are required for training YOLOv3 for object detection:
The following items are optional for training YOLOv3:
Note Refer to the topic Creating Mask ROIs for information about creating mask ROIs.
Multi-ROIs that are used as the target output for object detection must meet the following conditions:
Note Applying a mask may limit the number of input patches that are processed.

Note You should note that 'n' class models require multi-ROIs with n+1 labels.
You should note that object detection models require boxes as an input. Dragonfly automatically internally converts each multi-ROI island into a box so that both segmentations shown below are valid training outputs. You should also note that the background is fully labeled.
Segmentation options for object detection
Patch size, class count, and input count can be selected in the Model Information dialog whenever you generate a new YOLOv3 model.
Click the New button on the Train tab to open the dialog, shown below.
Model Information dialog
|
|
Description |
|---|---|
|
Patch size |
During training, training data is split into smaller 2D data patches, which is defined by the 'Patch size' parameter. For example, if you choose a Patch size of 256, the dataset will be cut into sub-sections of 256ยด256 pixels. These subsections will then be used for training. By subdividing images, each pass or 'epoch' should be faster and use less memory. However, patches should be large enough to fully enclose the object(s) to be detected. Note Smaller patch sizes generally yield more truncated boxes resulting from boundary artifacts. You should use the biggest possible patch size for the best results |
|
Class count |
Class count is the number of object classes to detect. For example, a kidney detection model usually has two classes โ Left Kidney and Right Kidney. Note The entered Class count should not include the background labeled in the multi-ROI. A background class is added automatically. For example, if you choose '4' as the class count, then the classes that appear on the Train tab will be: Background, Class 1, Class 2, Class 3, and Class 4. |
|
Input count |
Input count is number of channels in the input dataset โ '1' for grayscale and '3' for color images with red, green, and blue channels. |
The YOLOv3 dialog appears.
The Model Information dialog appears.


Recommendation Smaller patch sizes generally yield more truncated boxes resulting from boundary artifacts. You should use the biggest possible patch size for the best results.

Note The entered Class count should not include the background labeled in the output multi-ROI. A background class is added automatically. For example, if you choose '4' as the class count, then the classes that appear on the Train tab will be: Background, Class 1, Class 2, Class 3, and Class 4.

Input count is number of channels in the input dataset โ '1' for grayscale and '3' for color images with red, green, and blue channels.
After processing is complete, the model appears in the Model list.
Note A background class is assigned automatically and your labeled classes in the output multi-ROI must match this.

You can start training a YOLOv3 model for object detection after you have prepared your training input(s) and output(s), as well as any required masks (see Prerequisites).
To open the dialog, choose Artificial Intelligence > Custom Deep Model Architecture > YOLOv3 on the menu bar.
Note In this case, you will need to click the Load button to load the selected model.

Note If your model requires multiple inputs, for example when working with color images, select the additional input(s), as required.

Note Only multi-ROIs with the number of classes corresponding to model's class count and that have the same geometry as the input dataset will be available in the menu.
Note If you are training with multiple training sets, click the Add New
button and then choose the required input(s), output, and mask for the additional item(s).
The completed Inputs should look something like this:

In most cases, the default values should give good results.
Note You should monitor the estimated memory ratio when you choose the training parameter settings. The ratio should not exceed 1.00 (see Estimated memory ratio).
The dataset is validated and then automatically split into training and validation sets before training begins. You can monitor the progress of training in the Training Model dialog, as shown below.
During training, the quantities 'loss' and 'val_loss' should decrease. You should continue to train until 'val_loss' stops decreasing.
Note You can also click the List tab and then view the training metric values for each epoch.
You can preview the results of training on an image slice of a selected dataset with the options in the Preview box, shown below.
Preview
You should note that only the section of the dataset that is visible in the view will be processed.
The preview appears in the selected view.